package com.jiangjiang.eshop.wms.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiangjiang.eshop.wms.dao.WmsGoodsStockMapper;
import com.jiangjiang.eshop.wms.domain.WmsGoodsStock;
import org.springframework.stereotype.Service;

import java.sql.Wrapper;
import java.util.List;
import java.util.Set;

/**
 * @Author Jianghaowen
 * @Date 2021/9/14
 * @Description: TODO
 * @Version V1.0
 **/
@Service
public class WmsGoodsStockService extends ServiceImpl<WmsGoodsStockMapper, WmsGoodsStock> {

    /**
     * 根据sku id 集合查询商品库存数据
     * @param goodsSkuIds 商品skuid集合
     * @return 查询结果
     */
    public List<WmsGoodsStock> queryBySkuIds(Set<Long> goodsSkuIds) {
        LambdaQueryWrapper<WmsGoodsStock> wrapper = Wrappers.lambdaQuery();
        wrapper.in(WmsGoodsStock::getGoodsSkuId, goodsSkuIds);
        return this.list(wrapper);
    }
}
